using System;
using System.IO;
using ns9;

namespace ns10
{
	internal static class Class60
	{
		private const int int_0 = 8388608;

		private static readonly object[] object_0 = new object[8] { 8388608, 2, 3, 0, 2, 128, "bt4", false };

		private static readonly Enum5[] enum5_0 = new Enum5[8]
		{
			Enum5.const_1,
			Enum5.const_5,
			Enum5.const_6,
			Enum5.const_7,
			Enum5.const_12,
			Enum5.const_8,
			Enum5.const_9,
			Enum5.const_14
		};

		public static byte[] smethod_0(byte[] byte_0)
		{
			using MemoryStream stream_ = new MemoryStream(byte_0);
			return smethod_1(stream_);
		}

		public static byte[] smethod_1(Stream stream_0)
		{
			MemoryStream memoryStream = new MemoryStream();
			Class55 @class = new Class55();
			@class.imethod_1(enum5_0, object_0);
			@class.imethod_2(memoryStream);
			long length = stream_0.Length;
			for (int i = 0; i < 8; i++)
			{
				memoryStream.WriteByte((byte)(length >> 8 * i));
			}
			@class.imethod_0(stream_0, memoryStream, -1L, -1L, null);
			return memoryStream.ToArray();
		}

		public static byte[] smethod_2(byte[] byte_0)
		{
			using MemoryStream stream_ = new MemoryStream(byte_0);
			return smethod_3(stream_);
		}

		public static byte[] smethod_3(Stream stream_0)
		{
			Class52 @class = new Class52();
			stream_0.Seek(0L, SeekOrigin.Begin);
			MemoryStream memoryStream = new MemoryStream();
			byte[] array = new byte[5];
			if (stream_0.Read(array, 0, 5) != 5)
			{
				throw new Exception("input .lzma is too short");
			}
			long num = 0L;
			for (int i = 0; i < 8; i++)
			{
				int num2 = stream_0.ReadByte();
				if (num2 >= 0)
				{
					num |= (long)((ulong)(byte)num2 << 8 * i);
					continue;
				}
				throw new Exception("Can't Read 1");
			}
			@class.imethod_1(array);
			long long_ = stream_0.Length - stream_0.Position;
			@class.imethod_0(stream_0, memoryStream, long_, num, null);
			return memoryStream.ToArray();
		}
	}
}
